<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>网格添加页面</title>
  <link rel="stylesheet" href="../../../yl/index.css" />
  <!-- 布局样式 -->
  <link rel="stylesheet" href="../../../yl/style.css" />
  <link rel="stylesheet" href="../../../style/wangeditor.css" />
  <link rel="stylesheet" href="../../../yl/mobile.css" />
  <link rel="stylesheet" href="../../../yl/easyui.css" />
  <link rel="stylesheet" href="../../../yl/icon.css" />
</head>

<body>
  <!-- <div id="app"> -->
  <div class="easyui-navpanel" id="app" v-cloak>
    <header>
      <div class="m-toolbar">
        <div class="m-title">
          {{action=='Add'?'添加网格信息':action=='Modify'?'修改网格信息':'添加网格员信息'}}
        </div>
      </div>
    </header>
    <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px"
      id="MainTable" ref="MainTable"
      :data-options="JSON.stringify({ 'TableName': 'grid_information', 'form': 'dataForm' ,'primary_key':'Grid_SerialNumber' })">
      <div class="yl-main">
        <div class="table_titel">
          <div class="titel">网格信息</div>
        </div>
        <el-form :model="dataForm" ref="form" :inline-message="true" style="width: 100%">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">网格名称</div>
              </template>
              <el-form-item prop="Grid_Name" :rules="[{ required: true, message: '请输入网格名称', trigger: 'blur' }]">
                <el-input v-model="dataForm.Grid_Name" class="borderless-input" placeholder="请输入网格名称" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">所属父网格名称</div>
              </template>
              <yl-select :disabled="(action=='Add'&&nodeKey!='')||cityValue1.length > 0" @change="changeParent"
                v-model="Parent_Grid_SerialNumber" clearable filterable placeholder="请选择所属父网格名称" :options="Grid"
                :props="{value:'Grid_SerialNumber',label:'Grid_Name'}">
                <el-table-column prop="Grid_SerialNumber" show-overflow-tooltip label="网格编号"></el-table-column>
                <el-table-column prop="Grid_Name" show-overflow-tooltip label="网格名称"></el-table-column>
              </yl-select>
            </el-descriptions-item>
            <el-descriptions-item v-if="!Parent_Grid_SerialNumber">
              <template #label>
                <div class="cell-item">省/市/区(县)</div>
              </template>
              <el-cascader @change="changeCity" v-model="cityValue" filterable class="borderless-input"
                :props="{value:'value',label:'label',children:'children'}" placeholder="请选择省/市/区(县)" :options="city"
                style="width: 100%"></el-cascader>
            </el-descriptions-item>
            <el-descriptions-item v-if="!Parent_Grid_SerialNumber">
              <template #label>
                <div class="cell-item">乡镇(街道)/村庄(社区)</div>
              </template>
              <el-cascader :disabled="city1.length == 0" @change="changeCity1" class="borderless-input"
                v-model="cityValue1" filterable :props="{value:'ProvinceNumber',label:'Province',children:'children'}"
                placeholder="请选择乡镇(街道)/村庄(社区)" :options="city1" style="width: 100%"></el-cascader>
            </el-descriptions-item>
            <el-descriptions-item label="网格地理坐标集">
              <template #label>
                <div class="cell-item">网格地理坐标集</div>
              </template>
              <el-input  type="textarea"  :autosize="{ minRows: 2}" @input="InputCoords" v-model="dataForm.Coords" class="borderless-input"
                placeholder="请输入网格地理坐标集" />
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <div id="ChildTable">
          <div class="table_titel">
            <div class="titel">网格资源</div>
            <div class="operation">
              <el-button type="primary" size="small" @click="handleAdd('childDataForm1')">新增</el-button>
              <el-button type="danger" size="small" @click="handleRemove('childDataForm1')">删除</el-button>
            </div>
          </div>
          <el-descriptions
            :data-options="JSON.stringify({ 'TableName': 'grid_resource', 'form': 'childDataForm1', 'ParentTableName': 'grid_information'})"
            :column="2" size="large" border
            v-for="(item,index) in childDataForm1.filter(item => item.Row_Status != '1')" :key="index">
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">资源类型</div>
              </template>
              <el-select clearable v-model.trim="item.Resource_Type" placeholder="请选择资源类型" filterable
                style="width: 100%">
                <el-option
                  v-for="(item,index) in [{label:'监控',value:'1'},{label:'消防设施',value:'2'},{label:'宣传栏',value:'3'}]"
                  :key="index" :label="item.label" :value="item.value"></el-option>
              </el-select>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">坐标点</div>
              </template>
              <el-input v-model="item.Coordinate" class="borderless-input" placeholder="请输入坐标" />
            </el-descriptions-item>
          </el-descriptions>
          <div class="table_titel">
            <div class="titel">网格下蓝牌</div>
            <div class="operation">
              <el-button type="primary" size="small" @click="handleAdd('childDataForm2')">新增</el-button>
              <el-button type="danger" size="small" @click="handleRemove('childDataForm2')">删除</el-button>
            </div>
          </div>
          <el-descriptions
            :data-options="JSON.stringify({ 'TableName': 'grid_mapping_blue_plate', 'form': 'childDataForm2', 'ParentTableName': 'grid_information'})"
            :column="2" size="large" border>
            <el-descriptions-item v-for="(item,index) in childDataForm2.filter(item => item.Row_Status != '1')" :key="index">
              <template #label>
                <div class="cell-item">蓝牌编号</div>
              </template>
              <yl-select v-model="item.Blue_Plate_SerialNumber" clearable filterable placeholder="请选择蓝牌编号"
                :options="blue_plate.filter(i=>i.Blue_Plate_SerialNumber==childDataForm2[index].Blue_Plate_SerialNumber||(i.isSelect == '0' && !childDataForm2.filter(item => item.Row_Status != '1').some(x=>i.Blue_Plate_SerialNumber==x.Blue_Plate_SerialNumber)))" :props="{value:'Blue_Plate_SerialNumber',label:'label'}">
                <el-table-column prop="Blue_Plate_Name" show-overflow-tooltip label="蓝牌名称"></el-table-column>
                <el-table-column prop="Blue_Plate_SerialNumber" show-overflow-tooltip label="蓝牌编号"></el-table-column>
                <el-table-column prop="Unit_Quantity" show-overflow-tooltip label="单元"></el-table-column>
                <el-table-column prop="Layer_Quantity" show-overflow-tooltip label="层数"></el-table-column>
                <el-table-column prop="Room_Quantity" show-overflow-tooltip label="户"></el-table-column>
              </yl-select>
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <!-- <template
          v-if="blue_plate.filter(i=>childDataForm2.filter(x=>x.Row_Status!='1').some(j=>j.Blue_Plate_SerialNumber==i.Blue_Plate_SerialNumber)).length > 0">
          <div class="table_titel">
            <div class="titel">蓝牌下单元负责人</div>
          </div>
          <el-tabs type="border-card">
            <el-tab-pane :label="item.Blue_Plate_Name"
              v-for="(item,index) in blue_plate.filter(i=>childDataForm2.filter(x=>x.Row_Status!='1').some(j=>j.Blue_Plate_SerialNumber==i.Blue_Plate_SerialNumber))"
              :key="index">
              <el-descriptions :column="2" size="large" border>
                <el-descriptions-item v-for="(obj,id) in house_unit[item.Blue_Plate_SerialNumber]" :key="id">
                  <template #label>
                    <div class="cell-item">
                      {{numberToChinese(obj.Unit_Number)}}单元负责人
                    </div>
                  </template>
                  <el-select clearable v-model.trim="obj.Responsible_Person" placeholder="请选择负责人" filterable
                    style="width: 100%">
                    <el-option v-for="(item,index) in personal" :key="index" :label="item.Personal_Name"
                      :value="item.ID_Card_Number"></el-option>
                  </el-select>
                </el-descriptions-item>
              </el-descriptions>
            </el-tab-pane>
          </el-tabs>
        </template> -->
      </div>

    </div>
    <footer class="botton-ann">
      <el-button @click="goBack">返回</el-button>
      <el-button type="primary" :loading="loading" plain @click="handleSubmit">提交</el-button>
    </footer>
  </div>
</body>
<script src="../../../utils/utils.js"></script>
<script src="../../../config/config.js"></script>
<script src="../../../utils/ID_Validity.js"></script>
<script src="../../../utils/compressor.js"></script>
<script src="../../../utils/wangeditor.js"></script>
<script src="../../../utils/mixins.js"></script>
<script src="../../../yl/vue.js"></script>
<script src="../../../yl/index.js"></script>
<script src="../../../yl/zh-cn.mjs"></script>
<script src="../../../yl/index.iife.min.js"></script>
<script src="../../../yl/jquery.min.js"></script>
<script src="../../../utils/jquery.cookie.js"></script>
<script src="../../../yl/jquery.easyui.min.js"></script>
<script src="../../../yl/jquery.easyui.mobile.js"></script>
<script src="../../../yl/moment.min.js"></script>
<script src="../../../api/request.js"></script>
<script src="./js/add.js"></script>

</html>